package com.my.objects;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
 * @description:
 * @author: marshal
 * @date: 2021-08-24 2:19 PM
 */
public class ObjectInputStreamTest {
    public static void main(String[] args) {
        // 反序列化一个对象
        try (var ois = new ObjectInputStream(new FileInputStream("file/object_output_stream.txt"))) {
            var p = (Person) ois.readObject();
            System.out.println(p);
        } catch (IOException | ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
}
